package com.code.leetcode.before50;

/**
 * @author codeDorado
 * @version 1.0
 * @date 2020/7/19 20:51
 */
public class The26 {

    public int removeDuplicates(int[] nums) {
        if(nums == null || nums.length < 1) return 0;
        int len = nums.length;
        int x = 1;
        int curr = nums[0];
        for (int i = 1; i < len; i++) {
            if (nums[i] != curr) {
                nums[x] = nums[i];
                curr = nums[i];
                x++;
            }
        }
        return x;
    }

}
